package com.zzyl.nursing.controller.member;
/*
 *TODO
 *@Autor Adam
 *@Date  2025/7/31  19:40
 *
 */

import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.dto.ProjectPageDto;
import com.zzyl.nursing.service.OrdersService;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/member/orders")
public class OrdersController extends BaseController {
    @Autowired
    private OrdersService ordersService;

    /**
     * 分页查询护理项目列表
     *
     * @param dto
     * @return
     */
    @GetMapping("/project/page")
    public TableDataInfo<List<NursingProject>> projectPage(ProjectPageDto dto) {
        startPage();
        List<NursingProject> nursingProjects = ordersService.selectByDto(dto);
        return getDataTable(nursingProjects);
    }

    /**
     * 根据编号查询护理项目信息
     * @param id
     * @return
     */
    @GetMapping("/project/{id}")
    public AjaxResult selectById(@PathVariable Long id) {
        NursingProject nursingProject = ordersService.selectById(id);
        return success(nursingProject);
    }
}
